package 异常.day1.demo7;

public class Cake {
    long id;

    public Cake(long id) {
        this.id = id;
        System.out.println("cake id="+id+"被创建了");
    }

    //当一个对象即将被回收时，会先调用该方法，final,finally,finalize
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("==========================cake id="+id+"被锁毁了===========================");
    }
}
